<?php
using("Expression_Operator");
using("Expression_Exception");

/**
 * Unary operators are placed before any operands
 * 
 * <p>Unary operators can have more than one operand but the operator
 * will always be the leftmost symbol.
 * 
 * TODO this isn't really "Unary" so I should rename it
 *
 * @author Alexander Schearer <aas11@duke.edu>
 */
class Expression_Operator_Unary extends Expression_Operator {

	public function evaluate() {		
		$result = $this->build($this->getOperator());
		while (current($this->_children)) {
			$this->build($this->invokeLeaf(current($this->_children)));
			next($this->_children);
		}
		return $this->compile();
	}
}
?>